package com.feiyi.app.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.feiyi.app.R;
import com.feiyi.app.bean.AddressListBean;

import java.util.List;

/**
 * @author wangliantao
 * @time 2018 11 2018/11/19 1:45 AM
 * @email 1346947404@qq.com
 * @package com.feiyi.app.adapter
 * @describe： In me the tiger sniffs the rose
 */
public class AddressListAdapter extends BaseQuickAdapter<AddressListBean.DataBean,BaseViewHolder> {
    public AddressListAdapter(int layoutResId, @Nullable List<AddressListBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AddressListBean.DataBean item) {

        if (item.getDefault_address() == 1){
            helper.setGone(R.id.iv_choosed_address,true);
            helper.setGone(R.id.iv_default,true);
        }else {
            helper.setGone(R.id.iv_choosed_address,false);
            helper.setGone(R.id.iv_default,false);
        }
        helper.setText(R.id.tv_name,item.getConsignee())
                .setText(R.id.tv_mobile,item.getMobile()+"")
                .setText(R.id.tv_address_detail,item.getProvince_name()+item.getCity_name()+item.getDistrict_name()+item.getAddress());
        helper.addOnClickListener(R.id.iv_edit_address);

    }
}
